int binary_search(int* a,unsigned int num,int element)
{
	int begin,mid,end;
	
	begin = 0;
	end = num - 1;

	while(begin<=end)
	{
		mid = (begin + end)/2;
		if(a[mid] == element)
		{
			return mid;
		}
		else if(a[mid] < element)
		{
			begin = mid + 1;
		}
		else
		{
			end = mid - 1;
		}
	}

	return -1;
}
